<template>
  <el-card>
    <!-- 彩色按钮 -->
    <el-row :gutter="10">
      <el-col :span="6" v-for="i in btnList" :key="i.id">
        <div class="button" :class="i.bgColor">
          <div>
            <div class="icon">
              <i :class="i.icon"></i>
            </div>
            <div class="text">{{ i.text }}</div>
          </div>
          <div>
            <div class="number">{{ i.number }}</div>
          </div>
        </div>
      </el-col>
    </el-row>
  </el-card>
</template>

<script>
export default {
  name: "rightBottom",
  created() {
    // 首页临时救助记录
    this.API.getDataByMap().then(res => {
      console.log(res.data);
      // this.btnList[0];
    });
    // 首页查询辅助器具申请数量
    this.API.getAssistDataByHome().then(res => {
      console.log(res.data);
      this.btnList[1].text += res.data["次"] + "次";
      this.btnList[1].number = res.data["人"] + "人";
    });
    // 首页查询儿童康复救助数量
    this.API.getCountData().then(res => {
      console.log(res.data);
      this.btnList[0].text += res.data["次"] + "次";
      this.btnList[0].number = res.data["人"] + "人";
    });
    // 首页技能培训数据
    this.API.getSkillDataByHome().then(res => {
      console.log(res.data);

      this.btnList[3].text += res.data["次"] + "次";
      this.btnList[3].number = res.data["人"] + "人";
    });
    // 首页获取无障碍改造人员数据
    this.API.getRenouldDataByHome().then(res => {
      console.log(res.data);

      this.btnList[2].text += res.data["次"] + "次";
      this.btnList[2].number = res.data["人"] + "人";
    });
  },
  data() {
    return {
      btnList: [
        {
          id: 1,
          icon: "el-icon-search",
          text: "康复救助",
          number: "1,985",
          bgColor: "orange"
        },
        {
          id: 2,
          icon: "el-icon-search",
          text: "辅助器具",
          number: "2,234",
          bgColor: "blue"
        },
        {
          id: 3,
          icon: "el-icon-search",
          text: "无障碍改造",
          number: "255",
          bgColor: "cyan"
        },
        {
          id: 4,
          icon: "el-icon-search",
          text: "技能培训",
          number: "653",
          bgColor: "green"
        }
      ]
    };
  }
};
</script>

<style scoped>
.el-card {
  font-size: 0.7vw;
}
/deep/ .el-card__body {
  padding: 10px;
}
.orange {
  background-image: linear-gradient(
    to top,
    #ff7a3b,
    #ff8b33,
    #ff9b2c,
    #feac27,
    #fabc25
  );
}
.blue {
  background-image: linear-gradient(
    to top,
    #4973ff,
    #3c81ff,
    #368fff,
    #3b9bff,
    #48a6ff
  );
}
.green {
  background-image: linear-gradient(
    to top,
    #4dffa5,
    #51f89a,
    #54f18f,
    #57ea84,
    #59e379
  );
}
.cyan {
  background-image: linear-gradient(
    to top,
    #30afeb,
    #31bcf0,
    #38c8f5,
    #45d4f8,
    #55e0fb
  );
}
.button {
  cursor: pointer;
  padding: 10px;
  color: white;
  height: 22vh;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.icon {
  display: inline-block;
  padding: 4px 6px;
  border-radius: 4px;
  background: #ffffff33;
}
.text {
  margin: 4px 0;
  font-weight: bold;
  font-size: 0.7vw;
}
.number {
  font-size: 0.7vw;
  font-weight: bold;
}
</style>
